package com.kitty.game.pet.handler;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.pet.FeedType;

import java.util.HashMap;
import java.util.Map;

public enum FeedHelper {
    INSTANCE;

    private static final Map<String, FeedPetHandler> handlers = new HashMap<>();

    public void init(String type, FeedPetHandler feedPetHandler) {
        handlers.put(type, feedPetHandler);
    }

    public FeedPetHandler getHandler(String type) {
        return handlers.get(type);
    }


    static {
        /**宠物洗炼*/
        INSTANCE.init(FeedType.REFINE.getType(), SpringUtils.getBean("RefineHandler", RefineHandler.class));
        /**野生宠物洗炼*/
        INSTANCE.init(FeedType.RESET.getType(), SpringUtils.getBean("ResetHandler", ResetHandler.class));
        /**强化*/
        INSTANCE.init(FeedType.REBUILD_MAG.getType(), SpringUtils.getBean("RebuildHandler", RebuildHandler.class));
        /**强化*/
        INSTANCE.init(FeedType.REBUILD_PHY.getType(), SpringUtils.getBean("RebuildHandler", RebuildHandler.class));
        /**打入妖石*/
        INSTANCE.init(FeedType.INSET_STONE.getType(), SpringUtils.getBean("InsetStoneHandler", InsetStoneHandler.class));
        /**使用神兽丹*/
        INSTANCE.init(FeedType.USE_DAN.getType(), SpringUtils.getBean("UseDanHandler", UseDanHandler.class));
        /**使用限制神兽丹*/
        INSTANCE.init(FeedType.USE_LIMIT_DAN.getType(), SpringUtils.getBean("UseDanHandler", UseDanHandler.class));
        /**宠物使用物品*/
        INSTANCE.init(FeedType.USE_PET_ITEM.getType(), SpringUtils.getBean("UsePetItemHandler", UsePetItemHandler.class));

    }
}
